from django.shortcuts import render
from django.http import HttpResponse,JsonResponse
from ..models import *
from django.core.urlresolvers import reverse
from django.contrib.auth.hashers import make_password, check_password
from project_1.settings import BASE_DIR
import json
from .viewsUser import loadFile
from django.http import Http404
from django.contrib.auth.decorators import permission_required



# 订单首页
def index(request):
	order = Order.objects.all().order_by("userid").order_by("-addtime")
	return render(request,'myadmin/order/index.html',{"data":order})
# 发货
def fahuo(request):
	oid = request.GET.get("id")
	ors = Order.objects.get(id=oid)
	ors.status=4
	ors.save()
	return HttpResponse("ok")


# 详情
def list(request):
	oid = request.GET.get("id",37)
	ors = Order.objects.get(id=oid).orderinfo_set.all()
	return render(request,'myadmin/order/list.html',{"data":ors})